package com.example.webbrowser.Database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

/**
 * authro:陈润嘉
 * Date：2021/7/18
 * description :数据库基准类
 * */
public class DataBaseHelper  extends SQLiteOpenHelper {

    public DataBaseHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    //用于创建数据表
    //数据库第一次加载时载入
    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "create table history(id integer primary key autoincrement,title text ,url text)";
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
